function [cdirname,piclocs,realFold] = findCorrectDataDirectory(seqname)
% this function just searched to return the actual image data set directory
dirnames{1,1}='/home/houman/work/test_data/';
dirnames{2,1}='C:\Documents and Settings\hrast019\Desktop\data\euclidean\';
dirnames{3,1}='E:\Documents and Settings\houman\Desktop\data\euclidean\';
dirnames{4,1}='C:\mystf\data\euclidean\';
dirnames{5,1}='C:\code\test_data\';
dirnames{6,1}='C:\code\euclidean\';

[m,~]=size(dirnames);

cdirname='';
for i=1:m
    curdirname=dirnames{i,1};
    
    
    if(exist([ curdirname ],'dir')~=0)
        if(  curdirname(size( curdirname,2))~='/' && curdirname(size( curdirname,2))~='\' )
            curdirname=[ curdirname '/'] ;
        end
        cdirname= curdirname;
        
        break;
    end
end

if(nargin>0)
    if(exist([ cdirname  seqname],'dir')==0)
        error([' sequence ' seqname ' not found in directory: ' cdirname]);
    else
        realFold=[cdirname  seqname '/'];
    end
end



if(nargout>1 && size(curdirname,2)>1 && nargin>0 )
    
    
    imgformats={'pgm','jpg','png','tif','ppm','PGM','JPG','PNG','TIF','PPM'};
    numimages=0;
    formatnum=1;
    
    while(numimages==0 && formatnum<=size(imgformats,2))
        
        piclocs=dir([realFold '*.' imgformats{1,formatnum}]);
        numimages=size(piclocs,1);
        formatnum=formatnum+1;
    end
    
    if(numimages==0)
        error([' sequence ' seqname ' has no images in directory: ' cdirname]);
    end
    
    
end

end